import axios from 'axios';

export interface ScheduleRule {
  id?: number;
  userId?: number;
  name?: string;
  cronExpression?: string;
  username?: string;
  isActive?: number;
  createAt?: number;
  updateAt?: number;
}

export interface PickingTemplate {
  id?: number;
  name?: string;
  entityType?: string;
  createAt?: number;
  updateAt?: number;
}

export interface ShelfRule {
  id?: number;
  userId?: number;
  username?: string;
  name?: string;
  ruleType?: string;
  entityType?: string;
  entityPayload?: string;
  isActive?: number;
  stop?: number;
  createAt?: number;
  updateAt?: number;
  skuIds: string[]; // validate:"required"，表示这个字段是必填的
}

// 获取定时任务列表
export function apiListScheduleRule(data:any) {
  return axios.post('/api/system/schedulerule/list', data);
}

export function apiAddScheduleRule(data:any) {
    return axios.post('/api/system/schedulerule', data)
}

export function apiEditScheduleRule(data:any) {
    return axios.put('/api/system/schedulerule', data)
}

export function apiInfoScheduleRule(id:any){
    return axios.get(`/api/system/schedulerule/${id}`)
}

export function apiDelScheduleRule(id:any){
    return axios.delete(`/api/system/schedulerule/${id}`)
}


export function apiListShelfRule(data:any) {
  return axios.post('/api/system/shelfrule/list', data);
}

export function apiAddShelfRule(data:any) {
    return axios.post('/api/system/shelfrule', data)
}

export function apiEditShelfRule(data:any) {
    return axios.put('/api/system/shelfrule', data)
}

export function apiInfoShelfRule(id:any){
    return axios.get(`/api/system/shelfrule/${id}`)
}

export function apiDelShelfRule(id:any){
    return axios.delete(`/api/system/shelfrule/${id}`)
}



export function apiListPickingTemplate(data:any) {
  return axios.post('/api/system/pickingtemplate/list', data);
}

export function apiAddPickingTemplate(data:any) {
    return axios.post('/api/system/pickingtemplate', data)
}

export function apiEditPickingTemplate(data:any) {
    return axios.put('/api/system/pickingtemplate', data)
}

export function apiInfoPickingTemplate(id:any){
    return axios.get(`/api/system/pickingtemplate/${id}`)
}

export function apiDelPickingTemplate(id:any){
    return axios.delete(`/api/system/pickingtemplate/${id}`)
}

export function apiListSystemConfig() {
  return axios.post('/api/system/confstatus');
}

export function apiAuthGJPOpen(){
    return axios.post('/api/system/authGJPOpen')
}